/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Tool.java
 *
 * Created on 31/03/2010, 15:36:03
 */

package viewer.main;

import builder.tree.PaintMultipleTreeNode;
import builder.tree.ToolTipTreeNode;
import data.mining.AspectMining;
import data.mining.Cluster;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import viewer.main.tree.TraceTree;
import viewer.main.tree.TreeDisplay;
import data.processing.Controller;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeSelectionModel;
import log.messages.LOG;
import utils.SwingWorker;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import viewer.main.tree.AspectView;
import viewer.main.tree.GraphicComponentView;
import viewer.main.tree.ObjectList;
import viewer.main.tree.SaveJTree;
import viewer.main.tree.Tree;

/**
 *
 * @author Luciana
 */
public class Tool extends javax.swing.JFrame implements TreeSelectionListener{
    private String strCurrentPath="";
    private String strCurrentPathSelected="";
    private String strCurrentFilePath="";
    private JTree jtree=null;
    private builder.tree.Tree tree = null;
    private String system = "";
    private Controller controller;
    private JInternalFrame jInternalFrameTree;
    private Cluster[] clusters;
    private String requiredMethod = "";
    private int size = 0;
    private JTree jtreeGSP=null;
    private DefaultMutableTreeNode sequenceTree = null;
    private ArrayList<ToolTipTreeNode> objectList;
    private ObjectList list;

    /** Creates new form Tool */
    public Tool() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jSplitPaneDivisor = new javax.swing.JSplitPane();
        jScrollPaneTree = new javax.swing.JScrollPane();
        jSplitPaneMiddle = new javax.swing.JSplitPane();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        jPanel = new javax.swing.JPanel();
        jPanelRepository = new javax.swing.JPanel();
        txtFPath = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jButton = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanelCompressors = new javax.swing.JPanel();
        jPanelNorthCompressor = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jComboBoxStep1 = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jComboBoxStep2 = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jComboBoxStep3 = new javax.swing.JComboBox();
        this.jComboBoxStep3.setVisible(false);
        jLabel15 = new javax.swing.JLabel();
        this.jLabel15.setVisible(false);
        txtMetrics = new javax.swing.JTextField();
        this.txtMetrics.setVisible(false);
        jLabel16 = new javax.swing.JLabel();
        txtFieldSelectedTraceCompressor = new javax.swing.JTextField();
        btnExecutePreProcessingg = new javax.swing.JButton();
        btnDeleteDirectoriess = new javax.swing.JButton();
        jPanelFeatures = new javax.swing.JPanel();
        jPanelFeature_South = new javax.swing.JPanel();
        jButtonFeature = new javax.swing.JButton();
        jTxtFeature = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jPanelRecoveryStructure = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        txFile = new javax.swing.JTextField();
        txtFNroClusters = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtFNroNivel = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtFNroCoberturaChamadas = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        btnGetStructure = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        txtFNumberCluster = new javax.swing.JTextField();
        jBtnObjectList = new javax.swing.JButton();
        jButtonGroupClasses = new javax.swing.JButton();
        jPanelDataMining = new javax.swing.JPanel();
        jPanelEast = new javax.swing.JPanel();
        btnBuildTree = new javax.swing.JButton();
        jBtnSaveSequence = new javax.swing.JButton();
        jCheckBoxGSP = new javax.swing.JCheckBox();
        jPanelNorth = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        txtFieldSelectedTrace = new javax.swing.JTextField();
        txtFieldSuporte = new javax.swing.JTextField();
        txtFSize = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jPanelCenter = new javax.swing.JPanel();
        radioEqual = new javax.swing.JRadioButton();
        radioPrefix = new javax.swing.JRadioButton();
        radioSuffix = new javax.swing.JRadioButton();
        radioBtnA_C = new javax.swing.JRadioButton();
        radioExtremity = new javax.swing.JRadioButton();
        jButtonCarryTree = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        txtFieldSelectedTraceAspect = new javax.swing.JTextField();
        jScrollPaneJList = new javax.swing.JScrollPane();
        jListTraceFile = new javax.swing.JList();
        jButtonInsertTraceFileAspect = new javax.swing.JButton();
        jBtnMine = new javax.swing.JButton();
        jLabel23 = new javax.swing.JLabel();
        txtFieldSupportAspect = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jBtnMine1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        txtFieldSelectedCompressorSummarizer = new javax.swing.JTextField();
        btnExecutePreProcessing = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        btnDeleteDirectories = new javax.swing.JButton();
        jPanelText = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPaneMessages = new javax.swing.JTextPane();
        jPanelProgress = new javax.swing.JPanel();
        labelProgressTask = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Summarizer Tool");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(843, 667));
        setName("Tool"); // NOI18N
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                formComponentResized(evt);
            }
        });

        jSplitPaneDivisor.setBorder(null);
        jSplitPaneDivisor.setDividerLocation(300);
        jSplitPaneDivisor.setResizeWeight(0.4);
        jSplitPaneDivisor.setAutoscrolls(true);
        jSplitPaneDivisor.setMinimumSize(new java.awt.Dimension(843, 667));
        jSplitPaneDivisor.setPreferredSize(new java.awt.Dimension(843, 667));

        jScrollPaneTree.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Trace Repository ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft Sans Serif", 0, 11))); // NOI18N
        jScrollPaneTree.setViewportBorder(javax.swing.BorderFactory.createEtchedBorder());
        jScrollPaneTree.setMinimumSize(new java.awt.Dimension(180, 300));
        jScrollPaneTree.setPreferredSize(new java.awt.Dimension(278, 590));
        jSplitPaneDivisor.setLeftComponent(jScrollPaneTree);

        jSplitPaneMiddle.setDividerLocation(470);
        jSplitPaneMiddle.setResizeWeight(0.4);
        jSplitPaneMiddle.setAutoscrolls(true);
        jSplitPaneMiddle.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jSplitPaneMiddle.setRightComponent(jLayeredPane1);

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        jScrollPane2.setAutoscrolls(true);
        jScrollPane2.setMinimumSize(new java.awt.Dimension(200, 660));

        jPanel.setMaximumSize(new java.awt.Dimension(368, 350));
        jPanel.setMinimumSize(new java.awt.Dimension(368, 300));
        jPanel.setPreferredSize(new java.awt.Dimension(368, 300));

        jPanelRepository.setMaximumSize(new java.awt.Dimension(368, 20));
        jPanelRepository.setMinimumSize(new java.awt.Dimension(100, 20));
        jPanelRepository.setPreferredSize(new java.awt.Dimension(368, 20));

        txtFPath.setEditable(false);
        txtFPath.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jLabel10.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel10.setText("Repository:");

        jButton.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 11));
        jButton.setText("...");
        jButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelRepositoryLayout = new javax.swing.GroupLayout(jPanelRepository);
        jPanelRepository.setLayout(jPanelRepositoryLayout);
        jPanelRepositoryLayout.setHorizontalGroup(
            jPanelRepositoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelRepositoryLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtFPath, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38))
        );
        jPanelRepositoryLayout.setVerticalGroup(
            jPanelRepositoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRepositoryLayout.createSequentialGroup()
                .addGroup(jPanelRepositoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(txtFPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane1MouseClicked(evt);
            }
        });

        jPanelCompressors.setPreferredSize(new java.awt.Dimension(400, 258));
        jPanelCompressors.setLayout(new java.awt.BorderLayout());

        jPanelNorthCompressor.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jPanelNorthCompressor.setPreferredSize(new java.awt.Dimension(494, 256));

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Steps for the data pre-processing ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft Sans Serif", 0, 11))); // NOI18N
        jPanel9.setFocusable(false);
        jLabel9.setVisible(false);

        jLabel7.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel7.setText("Step 1:");

        jComboBoxStep1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jComboBoxStep1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Compressor", "Minimum Granularity" }));
        jComboBoxStep1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBoxStep1ItemStateChanged(evt);
            }
        });
        jComboBoxStep1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxStep1ActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel8.setText("Step 2:");

        jComboBoxStep2.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        jComboBoxStep2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Minimum Granularity", "Compressor" }));
        jComboBoxStep2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBoxStep2ItemStateChanged(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel9.setText("Step 3:");

        jComboBoxStep3.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jComboBoxStep3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Compressor", "Minimum Granularity" }));
        jComboBoxStep3.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBoxStep3ItemStateChanged(evt);
            }
        });

        jLabel15.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel15.setText("Minimum Granularity :");

        txtMetrics.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxStep1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxStep3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jComboBoxStep2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(29, 29, 29))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtMetrics, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(39, 39, 39))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(jComboBoxStep2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMetrics, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jComboBoxStep1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(jComboBoxStep3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        jLabel16.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        jLabel16.setText("Selected Trace:");

        txtFieldSelectedTraceCompressor.setEditable(false);
        txtFieldSelectedTraceCompressor.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10)); // NOI18N

        btnExecutePreProcessingg.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        btnExecutePreProcessingg.setText("Execute");
        btnExecutePreProcessingg.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExecutePreProcessinggActionPerformed(evt);
            }
        });

        btnDeleteDirectoriess.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        btnDeleteDirectoriess.setText("Delete Selected Trace");
        btnDeleteDirectoriess.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteDirectoriessActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelNorthCompressorLayout = new javax.swing.GroupLayout(jPanelNorthCompressor);
        jPanelNorthCompressor.setLayout(jPanelNorthCompressorLayout);
        jPanelNorthCompressorLayout.setHorizontalGroup(
            jPanelNorthCompressorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelNorthCompressorLayout.createSequentialGroup()
                .addGroup(jPanelNorthCompressorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelNorthCompressorLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addGroup(jPanelNorthCompressorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnDeleteDirectoriess)
                            .addGroup(jPanelNorthCompressorLayout.createSequentialGroup()
                                .addComponent(jLabel16)
                                .addGap(2, 2, 2)
                                .addComponent(txtFieldSelectedTraceCompressor, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btnExecutePreProcessingg)))))
                .addContainerGap(143, Short.MAX_VALUE))
        );
        jPanelNorthCompressorLayout.setVerticalGroup(
            jPanelNorthCompressorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelNorthCompressorLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanelNorthCompressorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(txtFieldSelectedTraceCompressor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnExecutePreProcessingg))
                .addGap(18, 18, 18)
                .addComponent(btnDeleteDirectoriess)
                .addGap(46, 46, 46))
        );

        jPanelCompressors.add(jPanelNorthCompressor, java.awt.BorderLayout.PAGE_START);

        jTabbedPane1.addTab("Pre-Processing", jPanelCompressors);

        jPanelFeatures.setLayout(new java.awt.BorderLayout());

        jButtonFeature.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jButtonFeature.setText("Recover Functionalities");
        jButtonFeature.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonFeatureActionPerformed(evt);
            }
        });

        jTxtFeature.setEditable(false);
        jTxtFeature.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));

        jLabel3.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel3.setText("Trace :");

        javax.swing.GroupLayout jPanelFeature_SouthLayout = new javax.swing.GroupLayout(jPanelFeature_South);
        jPanelFeature_South.setLayout(jPanelFeature_SouthLayout);
        jPanelFeature_SouthLayout.setHorizontalGroup(
            jPanelFeature_SouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFeature_SouthLayout.createSequentialGroup()
                .addGroup(jPanelFeature_SouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFeature_SouthLayout.createSequentialGroup()
                        .addGap(281, 281, 281)
                        .addComponent(jButtonFeature))
                    .addGroup(jPanelFeature_SouthLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTxtFeature, javax.swing.GroupLayout.PREFERRED_SIZE, 376, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(144, Short.MAX_VALUE))
        );
        jPanelFeature_SouthLayout.setVerticalGroup(
            jPanelFeature_SouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelFeature_SouthLayout.createSequentialGroup()
                .addContainerGap(97, Short.MAX_VALUE)
                .addGroup(jPanelFeature_SouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTxtFeature, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(79, 79, 79)
                .addComponent(jButtonFeature)
                .addGap(20, 20, 20))
        );

        jPanelFeatures.add(jPanelFeature_South, java.awt.BorderLayout.CENTER);

        jTabbedPane1.addTab("Classification by Functionality", jPanelFeatures);

        jPanelRecoveryStructure.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jPanelRecoveryStructure.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jPanelRecoveryStructureFocusGained(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel5.setText("Selected File:");

        txFile.setEditable(false);
        txFile.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));

        txtFNroClusters.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jLabel2.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel2.setText("Maximum Number of Methods by Level: ");

        txtFNroNivel.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jLabel1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel1.setText("Maximum Depth of the Call Tree: ");

        jLabel4.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel4.setText("Minimum Ratio:");

        txtFNroCoberturaChamadas.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jLabel6.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel6.setText("%");

        btnGetStructure.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        btnGetStructure.setText("Recover Sub-Trees");
        btnGetStructure.setMaximumSize(new java.awt.Dimension(67, 23));
        btnGetStructure.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGetStructureActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel11.setText("The Maximum Cluster Number: ");

        txtFNumberCluster.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jBtnObjectList.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        jBtnObjectList.setText("Show List of Classes");
        jBtnObjectList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnObjectListActionPerformed(evt);
            }
        });

        jButtonGroupClasses.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jButtonGroupClasses.setText("Group Classes");
        jButtonGroupClasses.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGroupClassesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelRecoveryStructureLayout = new javax.swing.GroupLayout(jPanelRecoveryStructure);
        jPanelRecoveryStructure.setLayout(jPanelRecoveryStructureLayout);
        jPanelRecoveryStructureLayout.setHorizontalGroup(
            jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRecoveryStructureLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelRecoveryStructureLayout.createSequentialGroup()
                        .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelRecoveryStructureLayout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txtFNroClusters, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelRecoveryStructureLayout.createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txtFNroNivel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanelRecoveryStructureLayout.createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txFile, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelRecoveryStructureLayout.createSequentialGroup()
                                .addComponent(btnGetStructure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jBtnObjectList)
                                .addGap(18, 18, 18)
                                .addComponent(jButtonGroupClasses)))
                        .addGap(158, 158, 158))
                    .addGroup(jPanelRecoveryStructureLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtFNroCoberturaChamadas, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addContainerGap(419, Short.MAX_VALUE))
                    .addGroup(jPanelRecoveryStructureLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtFNumberCluster, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        jPanelRecoveryStructureLayout.setVerticalGroup(
            jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRecoveryStructureLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtFNroNivel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtFNroClusters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtFNroCoberturaChamadas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(txtFNumberCluster, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanelRecoveryStructureLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnGetStructure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBtnObjectList)
                    .addComponent(jButtonGroupClasses))
                .addGap(39, 39, 39))
        );

        jTabbedPane1.addTab("High-level View", jPanelRecoveryStructure);

        jPanelDataMining.setPreferredSize(new java.awt.Dimension(400, 258));
        jPanelDataMining.setLayout(new java.awt.BorderLayout());

        btnBuildTree.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        btnBuildTree.setText("Mining Sequences");
        btnBuildTree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuildTreeActionPerformed(evt);
            }
        });

        jBtnSaveSequence.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jBtnSaveSequence.setText("Save Recovered Patterns");
        jBtnSaveSequence.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSaveSequenceActionPerformed(evt);
            }
        });

        jCheckBoxGSP.setSelected(true);
        jCheckBoxGSP.setText("Padrão Classe");

        javax.swing.GroupLayout jPanelEastLayout = new javax.swing.GroupLayout(jPanelEast);
        jPanelEast.setLayout(jPanelEastLayout);
        jPanelEastLayout.setHorizontalGroup(
            jPanelEastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelEastLayout.createSequentialGroup()
                .addContainerGap(22, Short.MAX_VALUE)
                .addComponent(jBtnSaveSequence)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelEastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBoxGSP)
                    .addComponent(btnBuildTree))
                .addContainerGap())
        );
        jPanelEastLayout.setVerticalGroup(
            jPanelEastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelEastLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jCheckBoxGSP)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE)
                .addGroup(jPanelEastLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtnSaveSequence)
                    .addComponent(btnBuildTree)))
        );

        jPanelDataMining.add(jPanelEast, java.awt.BorderLayout.LINE_END);

        jLabel17.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel17.setText("Trace/Sequence:");

        jLabel18.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel18.setText("Support:");

        jLabel19.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel19.setText("Motive:");

        txtFieldSelectedTrace.setEditable(false);
        txtFieldSelectedTrace.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));

        txtFieldSuporte.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        txtFSize.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));

        jLabel20.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
        jLabel20.setText(" E.g. preffixes: size 1 = a%, size 2 = ab%");

        jLabel21.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 11));
        jLabel21.setText("Pattern Support: 5%");

        javax.swing.GroupLayout jPanelNorthLayout = new javax.swing.GroupLayout(jPanelNorth);
        jPanelNorth.setLayout(jPanelNorthLayout);
        jPanelNorthLayout.setHorizontalGroup(
            jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelNorthLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelNorthLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtFSize, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel20)
                        .addContainerGap())
                    .addGroup(jPanelNorthLayout.createSequentialGroup()
                        .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelNorthLayout.createSequentialGroup()
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtFieldSelectedTrace, javax.swing.GroupLayout.PREFERRED_SIZE, 355, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanelNorthLayout.createSequentialGroup()
                                .addComponent(jLabel18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtFieldSuporte, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel21)
                                .addGap(77, 77, 77)))
                        .addGap(102, 102, 102))))
        );
        jPanelNorthLayout.setVerticalGroup(
            jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelNorthLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelNorthLayout.createSequentialGroup()
                        .addComponent(txtFieldSelectedTrace, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtFieldSuporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21)))
                    .addGroup(jPanelNorthLayout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel18)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(txtFSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addGap(6, 6, 6))
        );

        jPanelDataMining.add(jPanelNorth, java.awt.BorderLayout.PAGE_START);

        radioEqual.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        radioEqual.setText("Equal Methods: abc");

        radioPrefix.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        radioPrefix.setText("Preffix: a%, ab%");

        radioSuffix.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        radioSuffix.setText("Suffix: %c, %bc");

        radioBtnA_C.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        radioBtnA_C.setText("Patterns: a%c");

        radioExtremity.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        radioExtremity.setText("Any Motive");

        jButtonCarryTree.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jButtonCarryTree.setText("Load Saved Pattern");
        jButtonCarryTree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCarryTreeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelCenterLayout = new javax.swing.GroupLayout(jPanelCenter);
        jPanelCenter.setLayout(jPanelCenterLayout);
        jPanelCenterLayout.setHorizontalGroup(
            jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCenterLayout.createSequentialGroup()
                        .addGroup(jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(radioEqual)
                            .addComponent(radioPrefix)
                            .addComponent(radioSuffix)
                            .addComponent(radioBtnA_C)
                            .addComponent(radioExtremity))
                        .addContainerGap(123, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCenterLayout.createSequentialGroup()
                        .addComponent(jButtonCarryTree)
                        .addContainerGap())))
        );
        jPanelCenterLayout.setVerticalGroup(
            jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCenterLayout.createSequentialGroup()
                .addComponent(radioEqual)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioPrefix)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioSuffix)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioBtnA_C)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioExtremity)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
                .addComponent(jButtonCarryTree))
        );

        jPanelDataMining.add(jPanelCenter, java.awt.BorderLayout.CENTER);

        jTabbedPane1.addTab("Sequence Mining", jPanelDataMining);

        jLabel22.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel22.setText("Trace Path:");

        txtFieldSelectedTraceAspect.setEditable(false);
        txtFieldSelectedTraceAspect.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));

        jListTraceFile.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jScrollPaneJList.setViewportView(jListTraceFile);

        jButtonInsertTraceFileAspect.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jButtonInsertTraceFileAspect.setText("Insert");
        jButtonInsertTraceFileAspect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonInsertTraceFileAspectActionPerformed(evt);
            }
        });

        jBtnMine.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jBtnMine.setText("Execute");
        jBtnMine.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnMineActionPerformed(evt);
            }
        });

        jLabel23.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel23.setText("Support:");

        txtFieldSupportAspect.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));

        jLabel24.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jLabel24.setText("%");

        jBtnMine1.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11));
        jBtnMine1.setText("Clear List");
        jBtnMine1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnMine1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPaneJList, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel23)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(txtFieldSupportAspect, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel24)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jBtnMine1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jBtnMine))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel22)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(txtFieldSelectedTraceAspect, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButtonInsertTraceFileAspect))))
                .addContainerGap(136, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtFieldSelectedTraceAspect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22)
                    .addComponent(jButtonInsertTraceFileAspect))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPaneJList, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtnMine)
                    .addComponent(jLabel23)
                    .addComponent(txtFieldSupportAspect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24)
                    .addComponent(jBtnMine1))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Aspect Mining", jPanel1);

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtFieldSelectedCompressorSummarizer.setEditable(false);
        txtFieldSelectedCompressorSummarizer.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10)); // NOI18N

        btnExecutePreProcessing.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        btnExecutePreProcessing.setText("Execute");
        btnExecutePreProcessing.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExecutePreProcessingActionPerformed(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        jLabel25.setText("Selected Trace:");

        btnDeleteDirectories.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 11)); // NOI18N
        btnDeleteDirectories.setText("Delete Selected Trace");
        btnDeleteDirectories.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteDirectoriesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap(395, Short.MAX_VALUE)
                        .addComponent(btnDeleteDirectories))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtFieldSelectedCompressorSummarizer, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnExecutePreProcessing)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(76, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnExecutePreProcessing)
                    .addComponent(txtFieldSelectedCompressorSummarizer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25))
                .addGap(65, 65, 65)
                .addComponent(btnDeleteDirectories)
                .addGap(25, 25, 25))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Data Pre-Processing", jPanel2);

        jPanelText.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Messages ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Microsoft Sans Serif", 0, 11))); // NOI18N
        jPanelText.setMaximumSize(new java.awt.Dimension(510, 99999));
        jPanelText.setMinimumSize(new java.awt.Dimension(100, 100));
        jPanelText.setPreferredSize(new java.awt.Dimension(200, 103));

        jTextPaneMessages.setEditable(false);
        jScrollPane1.setViewportView(jTextPaneMessages);

        javax.swing.GroupLayout jPanelTextLayout = new javax.swing.GroupLayout(jPanelText);
        jPanelText.setLayout(jPanelTextLayout);
        jPanelTextLayout.setHorizontalGroup(
            jPanelTextLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
        );
        jPanelTextLayout.setVerticalGroup(
            jPanelTextLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE)
        );

        jPanelProgress.setMaximumSize(new java.awt.Dimension(368, 14));
        jPanelProgress.setMinimumSize(new java.awt.Dimension(100, 14));
        jPanelProgress.setPreferredSize(new java.awt.Dimension(368, 14));

        labelProgressTask.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));

        javax.swing.GroupLayout jPanelProgressLayout = new javax.swing.GroupLayout(jPanelProgress);
        jPanelProgress.setLayout(jPanelProgressLayout);
        jPanelProgressLayout.setHorizontalGroup(
            jPanelProgressLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelProgressLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelProgressTask, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(165, Short.MAX_VALUE))
        );
        jPanelProgressLayout.setVerticalGroup(
            jPanelProgressLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(labelProgressTask, javax.swing.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanelLayout = new javax.swing.GroupLayout(jPanel);
        jPanel.setLayout(jPanelLayout);
        jPanelLayout.setHorizontalGroup(
            jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelLayout.createSequentialGroup()
                .addGroup(jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelLayout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(jTabbedPane1, 0, 0, Short.MAX_VALUE))
                    .addGroup(jPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanelProgress, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanelText, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE)
                    .addComponent(jPanelRepository, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanelLayout.setVerticalGroup(
            jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanelRepository, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelText, javax.swing.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelProgress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jScrollPane2.setViewportView(jPanel);

        jSplitPaneMiddle.setLeftComponent(jScrollPane2);

        jSplitPaneDivisor.setRightComponent(jSplitPaneMiddle);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSplitPaneDivisor, javax.swing.GroupLayout.DEFAULT_SIZE, 1137, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSplitPaneDivisor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 688, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void repaintComponents(){
        Graphics g = jPanelText.getGraphics();
        jPanelText.paint(g);
        Graphics g4 = jScrollPaneTree.getGraphics();
        jScrollPaneTree.paint(g4);
        Graphics g3 = jPanelProgress.getGraphics();
        jPanelProgress.paint(g3);
        
    }

    private void insertMessages(Controller controller) {
        this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+controller.getMessages().toString());
        controller.initialiseMessages();
    }

    public final void insertTraceTree() {
        File[] files = new File(strCurrentPath).listFiles();
        system = getSO();
        if(files != null){
            jtree = TraceTree.start(files);
            jtree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            jtree.addTreeSelectionListener(this);
            jScrollPaneTree.setViewportView(jtree);
            jScrollPaneTree.setVisible(true);
        }else this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+"It was not possible to generate the tree of traces to the path: "+strCurrentFilePath);
    }

    public void valueChanged(TreeSelectionEvent e) {
       DefaultMutableTreeNode node = (DefaultMutableTreeNode)
                           jtree.getLastSelectedPathComponent();
       isValidTrace(node);
    }

    private void isValidTrace(DefaultMutableTreeNode selectedNode){
        if(selectedNode != null){
           File[] files = new File(strCurrentPath).listFiles();
           if(files != null){
               String path ="";
               for(File file : files){
                   if(file.getName().equals(selectedNode.toString())){
                       strCurrentPathSelected = file.getAbsolutePath();
                       txtFieldSelectedTraceCompressor.setText(file.getName());
                       jTxtFeature.setText(file.getName());
                       txtFieldSelectedTrace.setText(file.getName());
                       txtFieldSelectedTraceAspect.setText(file.getName());
                       break;
                   }
                   else if(file.getName().equals(selectedNode.getPath()[1].toString())){
                       path = file.getAbsolutePath()+system+selectedNode.getPath()[2].toString();
                       for(int i=3; i<selectedNode.getPath().length; i++){
                           path = path + system+selectedNode.getPath()[i].toString();
                       }
                       strCurrentPathSelected = path;
                       txtFieldSelectedTraceCompressor.setText(path);
                       txtFieldSelectedTrace.setText(path);
                       txtFieldSelectedTraceAspect.setText(path);
                       jTxtFeature.setText(path);
                       txFile.setText(path);
                       break;
                 }
               }
           }
      }
    }

    private String getSO(){
        String dir = "";
        if(!strCurrentPath.startsWith("/")) dir = "\\";
        else dir = "/";
        return dir;
    }

    private File getFile(File file) {
        if(file.isDirectory()) return getFile(file.listFiles()[0]);
        return file;
    }

    //txtFNroClusters.getText(), txtFNroCoberturaChamadas.getText(), txtFNroNivel.getText(), strCurrentPathSelected,
     private void insertNewInternalFrame(JInternalFrame treeDisplay) {
        jInternalFrameTree = treeDisplay;
        jLayeredPane1.add(jInternalFrameTree, JLayeredPane.PALETTE_LAYER);
        jInternalFrameTree.setMaximizable(true);
        jInternalFrameTree.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
        jInternalFrameTree.setIconifiable(true);
        jInternalFrameTree.setClosable(true);
        jInternalFrameTree.setVisible(true);
        jInternalFrameTree.addMouseListener(new MouseAdapter(){
            public void mouseClicked(MouseEvent event){
                    doMouseClicked(event);
                }

            private void doMouseClicked(MouseEvent event) {
                if(event.getButton() == MouseEvent.BUTTON3 && event.getComponent().getParent().getParent() instanceof JSplitPane){
                      jInternalFrameTree = ((JInternalFrame)event.getComponent());
                      JPopupMenu jPopupMenu = new JPopupMenu();
                      JMenuItem jMenuItem = new JMenuItem("Window Preview");
                      jPopupMenu.add(jMenuItem);
                      jMenuItem.addActionListener(new ActionListener() {
                         public void actionPerformed(ActionEvent e) {
                            setNewWindowEnabled(false);
                         }

                        private void setNewWindowEnabled(boolean b) {
                            JFrame frame = new JFrame();
                            JMenuBar jMenuBar = new JMenuBar();
                            JMenu jMenu = new JMenu("Restore size");
                            jMenu.addMouseListener(new MouseAdapter() {
                                public void mouseClicked(MouseEvent event){
                                    jMenuSelected(event);
                                }

                                private void jMenuSelected(MouseEvent event) {
                                    if(event.getComponent() instanceof JMenu){
                                        Container container = event.getComponent().getParent().getParent().getParent();
                                        jInternalFrameTree = new JInternalFrame(((JFrame)event.getComponent().getParent().getParent().getParent().getParent()).getTitle());
                                        jInternalFrameTree.setToolTipText("teste");
                                        //jInternalFrameTree.add(null);
                                        insertNewInternalFrame(jInternalFrameTree);
                                    }
                                }
                            });
                            jMenuBar.add(jMenu);
                            frame.setJMenuBar(jMenuBar);
                            frame.setTitle(jInternalFrameTree.getTitle());
                            frame.add(jInternalFrameTree.getContentPane());
                            try {
                                jInternalFrameTree.setClosed(true);
                            } catch (PropertyVetoException ex) {
                                Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            //jInternalFrameTree.dispose();
                            //jInternalFrameTree = null;
                            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                            frame.setSize(800, 800);
                            frame.setVisible(true);
                        }
                      });
                      jPopupMenu.show(event.getComponent(), event.getX(), event.getY());
                }
            }
        });
    }

     public Object doStep1() throws IOException {
        return controller.step1(jComboBoxStep1.getSelectedIndex(), strCurrentPathSelected, jPanelProgress, labelProgressTask);
    }

    public Object doStep2(File newFilePathStep) throws IOException{
        return controller.step2(this.jComboBoxStep2.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
    }

    public Object doStep3(File newFilePathStep) throws IOException{
        return controller.step3(jComboBoxStep3.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
    }




//  public static JInternalFrame createLayer(String label, JPanel jPanelTree) {
//    return new SelfInternalFrame(label, jPanelTree);
//  }
//
//  static class SelfInternalFrame extends JInternalFrame {
//    public SelfInternalFrame(String s, JPanel jPanelTree) {
//      getContentPane().add(new JLabel(s), BorderLayout.CENTER);
//      setBounds(50, 50, 100, 100);
//      setResizable(true);
//      setClosable(true);
//      getContentPane().add(jPanelTree, java.awt.BorderLayout.CENTER);
//      setMaximizable(true);
//      setIconifiable(true);
//      setTitle(s);
//      setVisible(true);
//    }
//  }


    private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
//        if(jtree != null){
//               Dimension d = jPnlRepository.getSize();
//               jScrollPaneTree.setSize(d.width-7, d.height-30);
//               jScrollPaneTree.setViewportView(jtree);
//               jScrollPaneTree.setVisible(true);
////               jPnlRepository.add(jScrollPaneTree);
////               jPnlRepository.setVisible(true);
//        }
        jSplitPaneMiddle.setDividerLocation(470);
        //jLayeredPane1.add(createLayer("teste"), JLayeredPane.PALETTE_LAYER);
    }//GEN-LAST:event_formComponentResized

    private void jButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonActionPerformed
        JFileChooser fc;
        if(strCurrentPath.compareTo("")!=0){
            fc = new JFileChooser(strCurrentPath);
        }else{
            fc = new JFileChooser();
        }
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int intReturn = fc.showOpenDialog(txtFPath);
        if(intReturn == JFileChooser.APPROVE_OPTION){
            strCurrentPath=fc.getSelectedFile().getAbsolutePath();
            txtFPath.setText(strCurrentPath);
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch(Exception ex){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            }
            insertTraceTree();
        }
}//GEN-LAST:event_jButtonActionPerformed

    private void jComboBoxStep1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxStep1ItemStateChanged
        if(jComboBoxStep1.getSelectedIndex() == 1){
            jLabel15.setVisible(true);
            txtMetrics.setVisible(true);
        }else if(jComboBoxStep1.getSelectedIndex() == 0 && jComboBoxStep2.getSelectedIndex()!= 1 && jComboBoxStep3.getSelectedIndex() != 2){
            this.jLabel15.setVisible(false);
            this.txtMetrics.setVisible(false);
        }
}//GEN-LAST:event_jComboBoxStep1ItemStateChanged

    private void jComboBoxStep1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxStep1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxStep1ActionPerformed

    private void jComboBoxStep2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxStep2ItemStateChanged
        if(this.jComboBoxStep2.getSelectedIndex() > 0){
            this.jComboBoxStep3.setVisible(true);
            jLabel9.setVisible(true);
            this.jLabel15.setVisible(true);
            this.txtMetrics.setVisible(true);
        } else{
            this.jComboBoxStep3.setVisible(false);
            jLabel9.setVisible(false);
            this.jLabel15.setVisible(false);
            this.txtMetrics.setVisible(false);
        }
}//GEN-LAST:event_jComboBoxStep2ItemStateChanged

    private void jComboBoxStep3ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxStep3ItemStateChanged

}//GEN-LAST:event_jComboBoxStep3ItemStateChanged

    private void btnExecutePreProcessinggActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExecutePreProcessinggActionPerformed
        jTextPaneMessages.setText("");
        if(!txtFieldSelectedTraceCompressor.getText().endsWith(".info")){
            String dir = getSO();
            String step = "Passo 1";
            try{
                controller = new Controller(this.txtMetrics.getText(), dir);
                strCurrentPathSelected = controller.alterTraceRepository(strCurrentPathSelected);
                File newFilePathStep = null;
                jTextPaneMessages.setText("");
                repaintComponents();
                //jListFiles.setModel(new DefaultListModel());
                if((this.jComboBoxStep1.getSelectedIndex() == 1 || this.jComboBoxStep2.getSelectedIndex() == 1 || this.jComboBoxStep3.getSelectedIndex() == 2) && txtMetrics.getText().equals("")){
                    this.jTextPaneMessages.setText(jTextPaneMessages.getText() + LOG.compressorInvalidParameters());
                }else{
                    //controller.setStep1(this.jComboBoxStep1.getSelectedIndex(), this.strCurrentPathSelected, jPanelProgress, labelProgressTask);
                    //Thread th = new Thread(controller);
                    final SwingWorker worker = new SwingWorker() {
                        public Object construct() {
                            try {
                                return doStep1();
                            } catch (IOException ex) {
                                LOG.errorOcurred(ex.getMessage());
                            }
                            return null;
                        }
                        public void finished() {
                            insertMessages(controller);
                            labelProgressTask.setText(LOG.getMessageStep2() + jComboBoxStep2.getSelectedItem());
                            repaintComponents();
                            insertTraceTree();
                            labelProgressTask.setText(LOG.updatedRepository());
                        }
                    };
                    worker.start();
                    //newFilePathStep = controller.step1(this.jComboBoxStep1.getSelectedIndex(), this.strCurrentPathSelected, jPanelProgress, labelProgressTask);
                    //                        insertMessages(controller);
                    //                        labelProgressTask.setText("Executando o Passo 2:"+this.jComboBoxStep2.getSelectedItem());
                    //                        repaintComponents();
                    if(this.jComboBoxStep2.getSelectedIndex() > 0){
                        step = "Passo 2";
                        final SwingWorker worker2 = new SwingWorker() {
                            public Object construct() {
                                insertMessages(controller);
                                labelProgressTask.setText(LOG.getMessageStep3() + jComboBoxStep3.getSelectedItem());
                                try {
                                    return doStep2(new File(worker.get().toString()));
                                } catch (IOException ex) {
                                    Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                                }
                                return null;
                            }
                            public void finished() {
                                repaintComponents();
                                insertTraceTree();
                                labelProgressTask.setText(LOG.updatedRepository());
                            }
                        };
                        worker2.start();
                        //newFilePathStep = controller.step2(this.jComboBoxStep2.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
                        //insertMessages(controller);
                        if(this.jComboBoxStep3.getSelectedIndex() > 0){
                            step = "Passo 3";
                            SwingWorker worker3 = new SwingWorker() {
                                public Object construct() {
                                    try {
                                        return doStep3(new File(worker2.get().toString()));
                                    } catch (IOException ex) {
                                        Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                                    }
                                    return null;
                                }
                                public void finished() {
                                    insertMessages(controller);
                                    labelProgressTask.setText(LOG.updatingRepository());
                                    repaintComponents();
                                    insertTraceTree();
                                    labelProgressTask.setText(LOG.updatedRepository());
                                }
                            };
                            worker3.start();
                            //                                labelProgressTask.setText("Executando o Passo 3:"+this.jComboBoxStep3.getSelectedItem());
                            //                                repaintComponents();
                            //newFilePathStep = controller.step3(this.jComboBoxStep3.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
                            //                                insertMessages(controller);
                        }
                    }

                }
            }catch(NumberFormatException e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText() + LOG.numberFormatException() + e.toString());
            }catch(IOException e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+e.toString());
            } catch(Exception e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+ LOG.errorOcurred(step) + e.toString());
            } catch(Error error){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n "+error.toString() + " "+strCurrentPathSelected);
            }
        }
}//GEN-LAST:event_btnExecutePreProcessinggActionPerformed

    private void btnDeleteDirectoriessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteDirectoriessActionPerformed
        Controller.removeTrace(strCurrentPathSelected);
        jTextPaneMessages.setText("");
        insertTraceTree();
        strCurrentPathSelected="";
}//GEN-LAST:event_btnDeleteDirectoriessActionPerformed

    private void jButtonFeatureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFeatureActionPerformed
        jTextPaneMessages.setText("");
        labelProgressTask.setText(LOG.recoveringFunctionalities());
        repaintComponents();
        Controller control = null;
        if(new File(strCurrentPathSelected).isFile()) control = new Controller(strCurrentPathSelected);
        else control = new Controller(strCurrentPathSelected+getSO()+"trace.mark.txt");
        try {
            control.readFeatureMarkFile();
            control.splitFeatures();
            insertTraceTree();
            labelProgressTask.setText(LOG.recoveredFunctionalities());
        } catch (FileNotFoundException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        } catch (IOException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        } catch (SecurityException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        } catch (Error ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        }
}//GEN-LAST:event_jButtonFeatureActionPerformed

    private void btnGetStructureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGetStructureActionPerformed
        jTextPaneMessages.setText("");
        labelProgressTask.setText(LOG.recoveringTreeView());
        repaintComponents();
        File file = new File(strCurrentPathSelected);
        //String dir = getSO();
        file = getFile(file);
        if((tree == null )|| !tree.getFilePath().equals(file.getAbsolutePath())){
            tree = new builder.tree.Tree(file.getAbsolutePath());
            try {
                numberOfNodes = tree.generateTree();
            } catch (IOException ex) {
                ex.printStackTrace();
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch (NullPointerException ex){
                ex.printStackTrace();
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch(ArrayIndexOutOfBoundsException ex){
                ex.printStackTrace();
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch (Error ex) {
                ex.printStackTrace();
                this.jTextPaneMessages.setText( jTextPaneMessages.getText()+"\n"+ex.getMessage());
            }

        }
        if(tree.getTree() != null && !txtFNroClusters.getText().equals("") && !txtFNroCoberturaChamadas.getText().equals("")
                && !txtFNroNivel.getText().equals("") && !txtFNumberCluster.getText().equals("")
                && numberOfNodes > 0){
            try {
                TreeDisplay treeDisplay = new TreeDisplay(null);
                boolean updated = treeDisplay.begin(tree, txtFNroClusters.getText(), txtFNroCoberturaChamadas.getText(), 
                        txtFNroNivel.getText(), strCurrentPathSelected, getSO(), txtFNumberCluster.getText(), numberOfNodes);
                insertNewInternalFrame(treeDisplay.getTree());
                clusters = treeDisplay.getBestClusters();
                objectList = treeDisplay.getAmalgamateClasses();
                if(updated){
                    insertTraceTree();
                }
            } catch (ClassNotFoundException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch (InstantiationException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch (IllegalAccessException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            } catch (UnsupportedLookAndFeelException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            }catch (Error ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
            }
        }
        labelProgressTask.setText(LOG.recoveredTreeView());
}//GEN-LAST:event_btnGetStructureActionPerformed

    private void jPanelRecoveryStructureFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jPanelRecoveryStructureFocusGained
        tree = new builder.tree.Tree();
}//GEN-LAST:event_jPanelRecoveryStructureFocusGained

    private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked

}//GEN-LAST:event_jTabbedPane1MouseClicked

    private void jBtnObjectListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnObjectListActionPerformed
        list = new ObjectList(objectList);
        insertNewInternalFrame(list.generateList());
    }//GEN-LAST:event_jBtnObjectListActionPerformed

    private void btnBuildTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuildTreeActionPerformed
        jTextPaneMessages.setText("");
        repaintComponents();
        /* Getting the chosen radio */
        requiredMethod = " - Motivo: Prefixo";
        int option = 2;//for enabled radioPrefix
        if(this.radioEqual.isSelected()){ option = 1; requiredMethod = " - Motivo: Equal";} else if(this.radioSuffix.isSelected()){ option = 3; requiredMethod = " - Motivo: Suffix";} else if(this.radioExtremity.isSelected()) {option = 4; requiredMethod = " - Motivo: Any";} else if(this.radioBtnA_C.isSelected()) {option = 5; requiredMethod = " - Motivo: a..c";}
        /* Gets others parameters */
        size = 1;
        double support = 0.05;
        if(!this.txtFSize.getText().equals("")) size = Integer.parseInt(this.txtFSize.getText());
        if(!this.txtFieldSuporte.getText().equals("")) support = Double.parseDouble(this.txtFieldSuporte.getText())/100;
        if(!this.strCurrentPathSelected.equals("")){
            try {
                labelProgressTask.setText("Executando algoritmo GSP ...");
                repaintComponents();
                Tree sequenceTreeGSP = new Tree();
                File dataMining = null;
                if(new File(strCurrentPathSelected).isFile()) dataMining = new File(strCurrentPathSelected);
                else dataMining = new File(strCurrentPathSelected+system+"data.trace");
                if(dataMining.exists()){
                    jtreeGSP = sequenceTreeGSP.start(dataMining.getAbsolutePath(), option, size, support, requiredMethod, jPanelProgress, labelProgressTask, jCheckBoxGSP.isSelected());
                    sequenceTree = sequenceTreeGSP.getTree();
                    if(sequenceTreeGSP.getIsOk()){
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                        labelProgressTask.setText("Construindo árvore das sequências ... finalizado.");
                        insertSequenceTree();
                        repaintComponents();
                    }else this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n>> Nenhum candidato encontrado para o suporte "+(support*100)+"%.\n");
                }else this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n Arquivo não encontrado.");

            } catch (ClassNotFoundException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            } catch (InstantiationException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            } catch (IllegalAccessException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            } catch (UnsupportedLookAndFeelException ex) {
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            } catch(Exception ex){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            } catch(Error ex){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ ex);
            }
        }
}//GEN-LAST:event_btnBuildTreeActionPerformed

    private void jBtnSaveSequenceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSaveSequenceActionPerformed
        labelProgressTask.setText("Salvando árvore ...");
        jTextPaneMessages.setText("");
        repaintComponents();
        String dir = getSO();
        String support = "5";
        String motive = "";
        if(!txtFieldSuporte.getText().equals("")) support = txtFieldSuporte.getText();
        if(!requiredMethod.equals("")){
            String[] method = requiredMethod.split(" ");
            motive = method[method.length-1];
        }
        try{
            SaveJTree.saveModel(sequenceTree, null, new File(strCurrentPathSelected), dir, support, motive, size);
            insertTraceTree();
            labelProgressTask.setText("Salvando árvore ... finalizado.");
        }catch(IOException e){
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+e.toString());
        }
}//GEN-LAST:event_jBtnSaveSequenceActionPerformed

    private void jButtonCarryTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCarryTreeActionPerformed
        labelProgressTask.setText("Recuperando árvore ...");
        jTextPaneMessages.setText("");
        repaintComponents();
        try {
            DefaultMutableTreeNode model = SaveJTree.loadModel(new File(strCurrentPathSelected));
            viewer.main.tree.Tree treeToMemory = new viewer.main.tree.Tree();
            jtreeGSP = treeToMemory.setTree(model);
            insertSequenceTree();
            labelProgressTask.setText("Árvore recuperada.");
        } catch (FileNotFoundException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        } catch (IOException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        } catch (ClassNotFoundException ex) {
            this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+ex.toString());
        }
}//GEN-LAST:event_jButtonCarryTreeActionPerformed

    private void jButtonGroupClassesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGroupClassesActionPerformed
        if(!list.getSizeSelectionObjects()) {
            list.selectNodes();
        }
        list.groupObjects(clusters);
        insertNewInternalFrame(list.recoverGroups());

    }//GEN-LAST:event_jButtonGroupClassesActionPerformed

    private void jButtonInsertTraceFileAspectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonInsertTraceFileAspectActionPerformed
       DefaultListModel listModel = new DefaultListModel();
       for(int i = 0; i < jListTraceFile.getModel().getSize(); i++){
           listModel.addElement(jListTraceFile.getModel().getElementAt(i));
       }
       listModel.addElement(txtFieldSelectedTraceAspect.getText());
       jListTraceFile = new JList(listModel);
       jListTraceFile.setVisibleRowCount(listModel.size());
       jScrollPaneJList.setViewportView(jListTraceFile);
    }//GEN-LAST:event_jButtonInsertTraceFileAspectActionPerformed

    private void jBtnMineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnMineActionPerformed
       String[] paths = new String[jListTraceFile.getModel().getSize()];
       for(int i = 0; i < jListTraceFile.getModel().getSize(); i++){
           paths[i] = (String)jListTraceFile.getModel().getElementAt(i);
       }
       double support = 0.5;
       if(!this.txtFieldSupportAspect.getText().equals("")) support = Double.parseDouble(this.txtFieldSupportAspect.getText())/100;
        try {
            jtreeGSP = AspectView.start(paths, support);
        } catch (IOException ex) {
            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
        }
       insertSequenceTree();
    }//GEN-LAST:event_jBtnMineActionPerformed

    private void jBtnMine1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnMine1ActionPerformed
        jListTraceFile = new JList();
        jScrollPaneJList.setViewportView(jListTraceFile);
    }//GEN-LAST:event_jBtnMine1ActionPerformed

    private void btnExecutePreProcessingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExecutePreProcessingActionPerformed
        jTextPaneMessages.setText("");
        if(!txtFieldSelectedTraceCompressor.getText().endsWith(".info")){
            String dir = getSO();
            String step = "Passo 1";
            try{
                controller = new Controller();
                controller.setDirectory(dir);
                strCurrentPathSelected = controller.alterTraceRepository(strCurrentPathSelected);
//                File newFilePathStep = null;
                jTextPaneMessages.setText("");
                repaintComponents();
//                //jListFiles.setModel(new DefaultListModel());
//                if((this.jComboBoxStep1.getSelectedIndex() == 1 || this.jComboBoxStep2.getSelectedIndex() == 1 || this.jComboBoxStep3.getSelectedIndex() == 2) && txtMetrics.getText().equals("")){
//                    this.jTextPaneMessages.setText(jTextPaneMessages.getText() + LOG.compressorInvalidParameters());
//                }else{
                    //controller.setStep1(this.jComboBoxStep1.getSelectedIndex(), this.strCurrentPathSelected, jPanelProgress, labelProgressTask);
                    //Thread th = new Thread(controller);
                    final SwingWorker worker = new SwingWorker() {
                        public Object construct() {
                            try {
                                return doStep1();
                            } catch (IOException ex) {
                                Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            return null;
                        }
                        public void finished() {
                            insertMessages(controller);
                            labelProgressTask.setText(LOG.getMessageStep2() + jComboBoxStep2.getSelectedItem());
                            repaintComponents();
                            insertTraceTree();
                            labelProgressTask.setText(LOG.updatedRepository());
                        }
                    };
                    worker.start();

                    if(this.jComboBoxStep2.getSelectedIndex() > 0){
                        step = "Passo 2";
                        final SwingWorker worker2 = new SwingWorker() {
                            public Object construct() {
                                insertMessages(controller);
                                labelProgressTask.setText(LOG.getMessageStep3() + jComboBoxStep3.getSelectedItem());
                                try {
                                    return doStep2(new File(worker.get().toString()));
                                } catch (IOException ex) {
                                    Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                                }
                                return null;
                            }
                            public void finished() {
                                repaintComponents();
                                insertTraceTree();
                                labelProgressTask.setText(LOG.updatedRepository());
                            }
                        };
                        worker2.start();
                        //newFilePathStep = controller.step2(this.jComboBoxStep2.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
                        //insertMessages(controller);
                        if(this.jComboBoxStep3.getSelectedIndex() > 0){
                            step = "Passo 3";
                            SwingWorker worker3 = new SwingWorker() {
                                public Object construct() {
                                    try {
                                        return doStep3(new File(worker2.get().toString()));
                                    } catch (IOException ex) {
                                        Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
                                    }
                                    return null;
                                }
                                public void finished() {
                                    insertMessages(controller);
                                    labelProgressTask.setText(LOG.updatingRepository());
                                    repaintComponents();
                                    insertTraceTree();
                                    labelProgressTask.setText(LOG.updatedRepository());
                                }
                            };
                            worker3.start();
                            //                                labelProgressTask.setText("Executando o Passo 3:"+this.jComboBoxStep3.getSelectedItem());
                            //                                repaintComponents();
                            //newFilePathStep = controller.step3(this.jComboBoxStep3.getSelectedIndex(), newFilePathStep, jPanelProgress, labelProgressTask);
                            //                                insertMessages(controller);
                        }
                    }

//                }
            }catch(NumberFormatException e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText() + LOG.numberFormatException() + e.toString());
            }catch(IOException e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n"+e.toString());
            } catch(Exception e){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+ LOG.errorOcurred(step) + e.toString());
            } catch(Error error){
                this.jTextPaneMessages.setText(jTextPaneMessages.getText()+"\n "+error.toString() + " "+strCurrentPathSelected);
            }
        }
    }//GEN-LAST:event_btnExecutePreProcessingActionPerformed

    private void btnDeleteDirectoriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteDirectoriesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnDeleteDirectoriesActionPerformed


private void insertSequenceTree() {
     jtreeGSP.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
     jtreeGSP.addTreeSelectionListener(this);
     JScrollPane jScrollPaneGSP = new JScrollPane();
     jScrollPaneGSP.setViewportView(jtreeGSP);
     JInternalFrame jInternalFrameGSP = new JInternalFrame();
     jInternalFrameGSP.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
     jInternalFrameGSP.getContentPane().add(jScrollPaneGSP, java.awt.BorderLayout.CENTER);
     jInternalFrameGSP.setSize(400, 400);
     jInternalFrameGSP.setTitle(strCurrentPathSelected);
     insertNewInternalFrame(jInternalFrameGSP);
}
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Tool frame = new Tool();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    private int numberOfNodes;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuildTree;
    private javax.swing.JButton btnDeleteDirectories;
    private javax.swing.JButton btnDeleteDirectoriess;
    private javax.swing.JButton btnExecutePreProcessing;
    private javax.swing.JButton btnExecutePreProcessingg;
    private javax.swing.JButton btnGetStructure;
    private javax.swing.JButton jBtnMine;
    private javax.swing.JButton jBtnMine1;
    private javax.swing.JButton jBtnObjectList;
    private javax.swing.JButton jBtnSaveSequence;
    private javax.swing.JButton jButton;
    private javax.swing.JButton jButtonCarryTree;
    private javax.swing.JButton jButtonFeature;
    private javax.swing.JButton jButtonGroupClasses;
    private javax.swing.JButton jButtonInsertTraceFileAspect;
    private javax.swing.JCheckBox jCheckBoxGSP;
    private javax.swing.JComboBox jComboBoxStep1;
    private javax.swing.JComboBox jComboBoxStep2;
    private javax.swing.JComboBox jComboBoxStep3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JList jListTraceFile;
    private javax.swing.JPanel jPanel;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanelCenter;
    private javax.swing.JPanel jPanelCompressors;
    private javax.swing.JPanel jPanelDataMining;
    private javax.swing.JPanel jPanelEast;
    private javax.swing.JPanel jPanelFeature_South;
    private javax.swing.JPanel jPanelFeatures;
    private javax.swing.JPanel jPanelNorth;
    private javax.swing.JPanel jPanelNorthCompressor;
    private javax.swing.JPanel jPanelProgress;
    private javax.swing.JPanel jPanelRecoveryStructure;
    private javax.swing.JPanel jPanelRepository;
    private javax.swing.JPanel jPanelText;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPaneJList;
    private javax.swing.JScrollPane jScrollPaneTree;
    private javax.swing.JSplitPane jSplitPaneDivisor;
    private javax.swing.JSplitPane jSplitPaneMiddle;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextPane jTextPaneMessages;
    private javax.swing.JTextField jTxtFeature;
    private javax.swing.JLabel labelProgressTask;
    private javax.swing.JRadioButton radioBtnA_C;
    private javax.swing.JRadioButton radioEqual;
    private javax.swing.JRadioButton radioExtremity;
    private javax.swing.JRadioButton radioPrefix;
    private javax.swing.JRadioButton radioSuffix;
    private javax.swing.JTextField txFile;
    private javax.swing.JTextField txtFNroClusters;
    private javax.swing.JTextField txtFNroCoberturaChamadas;
    private javax.swing.JTextField txtFNroNivel;
    private javax.swing.JTextField txtFNumberCluster;
    private javax.swing.JTextField txtFPath;
    private javax.swing.JTextField txtFSize;
    private javax.swing.JTextField txtFieldSelectedCompressorSummarizer;
    private javax.swing.JTextField txtFieldSelectedTrace;
    private javax.swing.JTextField txtFieldSelectedTraceAspect;
    private javax.swing.JTextField txtFieldSelectedTraceCompressor;
    private javax.swing.JTextField txtFieldSuporte;
    private javax.swing.JTextField txtFieldSupportAspect;
    private javax.swing.JTextField txtMetrics;
    // End of variables declaration//GEN-END:variables


    //Código para gerar a interface grafica dos componentes que ficava dentro do botão
//        GraphicComponentView componentViews = new GraphicComponentView(clusters);
//        try {
//            componentViews.begin();
//        } catch (ClassNotFoundException ex) {
//            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (UnsupportedLookAndFeelException ex) {
//            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);
//        }

}
